package edu.spec.dengyan.week09.class02.homework;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * Author       : Dengyan
 * Date         : 2018/10/11 23:19
 * Description  : “Test”类
 */
public class Test {
    public static void main(String[] args) {
        //构造一个主人对象tom，tom养了2条猫，，4条狗。
        List pets=new ArrayList();
        List sounds1=new  ArrayList();
        sounds1.add("miao11");
        sounds1.add("miao12");
        sounds1.add("miao13");
        List foods1=new  ArrayList();
        Food food11=new Food("黄拉丁",50);
        Food food12=new Food("泥鳅",60);
        Food food13=new Food("汤泡饭",10);
        foods1.add(food11);
        foods1.add(food12);
        foods1.add(food13);
        Cat c1=new Cat("tom",sounds1,foods1);
        Cat c2=new Cat("花花",sounds1,foods1);
        List sounds2=new  ArrayList();
        sounds1.add("wang11");
        sounds1.add("wang12");
        sounds1.add("wang13");
        List foods2=new  ArrayList();
        Food food21=new Food("大骨头",10);
        Food food22=new Food("排骨",20);
        Food food23=new Food("火腿肠",2);
        foods2.add(food21);
        foods2.add(food22);
        foods2.add(food23);
        Dog dog1 = new Dog("大黄", sounds2, foods2);
        Dog dog2 = new Dog("金毛", sounds2, foods2);
        Dog dog3 = new Dog("藏獒", sounds2, foods2);
        Dog dog4 = new Dog("白白", sounds2, foods2);
        pets.add(c1);
        pets.add(c2);
        pets.add(dog1);
        pets.add(dog2);
        pets.add(dog3);
        pets.add(dog4);
        Mater tom=new Mater(pets);
        //主人的宠物可能发生变化
        List pList=tom.getPets();
        for(int i=0;i<pList.size();i++) {
            IPet a=(IPet)pList.get(i);//可以用父类引用指向子类
            tom.feed(a);
        }
    }

        /*List sounds = new ArrayList();
        sounds.add("瞄");
        sounds.add("敖");
        List food = new ArrayList();
        food.add("鱼");
        food.add("骨头");
        food.add("狗粮");
        food.add("猫粮");
        List foods = new ArrayList();
        foods.add(new Food("鱼", 10));
        foods.add(new Food("米饭", 3));
        //List a = new ArrayList();
        Animal a=new Cat("大黑", sounds,food);
        Animal b=new Cat("花花",sounds,food);
        Animal c=new Dog("阿拉斯加犬", sounds,food);
        Animal d=new Dog("金毛",sounds,food);
        Animal e=new Dog("二哈", sounds,food);
        Animal f=new Dog("拉布拉多",sounds,food);
        System.out.println(a.getSounds());
        System.out.println(a.getName()+a.getSounds()+a.getFoods());
        System.out.println(b.getName()+b.getSounds()+b.getFoods());
        System.out.println(c.getName()+c.getSounds()+c.getFoods());
        System.out.println(d.getName()+d.getSounds()+d.getFoods());
        System.out.println(f.getName()+f.getSounds()+f.getFoods());*/
// 请分别给这些动物起名字，定义他们喜欢吃的食物。
    }




